import 'dart:math';

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: MixedItemsExample());
  }
}

class MixedItemsExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Mixed Items with SliverChildBuilderDelegate")),
      body:  SizedBox(width: 600,height: 400,child:
      CustomScrollView(
        slivers: [
          SliverList(
            delegate: SliverChildBuilderDelegate(
                  (BuildContext context, int index) {
                if (index % 3 == 0) {
                  return Container(
                    color: Colors.amber,
                    height: 100,
                    child: Center(
                      child: Text("Big Item $index", style: TextStyle(fontSize: 24)),
                    ),
                  );
                } else if (index % 3 == 1) {
                  return ListTile(
                    leading: Icon(Icons.star),
                    title: Text("Standard List Item $index"),
                  );
                } else {
                  return Stack(
                    children: [
                      Positioned.fill(
                        child: Container(color: Colors.pinkAccent),
                      ),
                      Align(
                        alignment: Alignment.center,
                        child: Text(
                          "Stacked Item $index",
                          style: TextStyle(fontSize: 20, color: Colors.white),
                        ),
                      ),
                    ],
                  );
                }
              },
              childCount: 20, // Number of items
            ),
          ),
        ],
      )),
    );
  }
}
